private ["_callsign","_timer","_veh","_crew"];
if (isnil "PAPABEAR") then { PAPABEAR = [West,"HQ"]; };

_callsign = ceil (random 9);
_veh = _this select 0;
_crew = crew _veh;
sleep random 20;
_timer = time + RMM_cas_missiontime + random (180 max (RMM_cas_missiontime / 4));
_veh sideChat format [localize "STR_CAS_COMING", group player, _callsign,floor(_timer / 60)];
waituntil {sleep 5; time > _timer || !(alive _veh) || damage _veh > 0.3 || !(canMove _veh)};
if (alive _veh && damage _veh < 0.4 && canMove _veh) then {
	waituntil {sleep 5;{isplayer _x} count (crew _veh) == 0};
	(crew _veh) join (createGroup (side (driver _veh)));
	{
		_x setskill 0;
		_x disableai "TARGET";
		_x disableai "AUTOTARGET";
	} foreach (units (group _veh));
	(group _veh) addwaypoint [[-1000,-1000,1000],0];
	_veh sideChat format [localize "STR_CAS_OUTOFFUEL", group player, _callsign];
	sleep (RMM_cas_missiontime * 0.2);
	_veh call CBA_fnc_deleteEntity;
} else {
	PAPABEAR sideChat format [localize "STR_CAS_DAMAGED", group player, _callsign];
	sleep 20;
	{ if (alive _x && !isplayer _x) then { deleteVehicle _x; };	
	} foreach _crew;
	_veh call CBA_fnc_deleteEntity;
};